package com.tech.platform.dto;

import java.io.Serializable;

import org.springframework.beans.BeanUtils;
import com.swak.security.Principal;

import com.alibaba.fastjson.annotation.JSONField;
import com.swak.Constants;
import com.tech.platform.entity.TaskPrepare;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 描述
 * 
 * @author Auto Generator
 * @date 2021-09-14T14:32:44.495
 */
@Getter
@Setter
@Accessors(chain = true)
public class TaskPrepareDTO implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private Long id;
	private String name;
	@JSONField(format = Constants.Second_Format)
	private java.time.LocalDateTime planExecutionTime;
	@JSONField(format = Constants.Second_Format)
	private java.time.LocalDateTime beginDate;
	@JSONField(format = Constants.Second_Format)
	private java.time.LocalDateTime endDate;
	private Byte type;
	private Byte module;
	private Byte status;
	private Long shopId;
	private Long tenantId;
	@JSONField(format = Constants.Second_Format)
	private java.time.LocalDateTime createDate;
	@JSONField(format = Constants.Second_Format)
	private java.time.LocalDateTime updateDate;
	
	/**
	 * 操作人的身份
	 */
	private Principal principal;
	
	/**
	 * DTO 转换为 PO
	 *
	 * @param entity
	 * @return DTO
	 */
	public TaskPrepare transform() {
		TaskPrepare entity = new TaskPrepare();
		BeanUtils.copyProperties(this, entity);
		entity.setId(this.getId());
		entity.setCreateDate(this.getCreateDate());
		entity.setUpdateDate(this.getUpdateDate());
		return entity;
	}
	
	/**
	 * PO 转换为 DTO
	 *
	 * @param entity
	 * @return DTO
	 */
	public static TaskPrepareDTO convert(TaskPrepare entity) {
	    if (entity == null) { return null;}
		TaskPrepareDTO dto = new TaskPrepareDTO();
		BeanUtils.copyProperties(entity, dto);
		dto.setId(entity.getId());
		dto.setCreateDate(entity.getCreateDate());
		dto.setUpdateDate(entity.getUpdateDate());
		return dto;
	}
	
	/**
	 * 创建DTO
	 *
	 * @return DTO
	 */
	public static TaskPrepareDTO of() {
	    return new TaskPrepareDTO();
	}
}
